<?php /** Template Name: News */ get_header(); ?>
<div class="news">
    <div class="nav">
        <div class="news-nav">
            <a href="<?php bloginfo( 'home' ); ?>/news" class="hot">
                <?php if(qtrans_getLanguage()=='tw'): ?>
                    全部
                <?php endif; ?>
                <?php if(qtrans_getLanguage()=='en'): ?>
                    All
                <?php endif; ?>
                <?php if(qtrans_getLanguage()=='zh'): ?>
                    全部
                <?php endif; ?>
            </a>
            <?php wp_get_archives( array( 'type' => 'yearly','format'=>'a' ) ); ?>
        </div>
    </div>
    <div class="container">
        <div class="row">
            <?php if ( have_posts() ): while ( have_posts() ) : the_post(); ?>
            <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6">
                <a href="<?php echo get_post_meta($post->ID, "news_setting_link", $single = true) ?>" target="_blank" class="news-card">
                    <?php
                        $u_time = get_the_time('U');
                        if(time() - $u_time <= get_option('recent_setting')*86400) {
                            echo '<span class="newicon"></span>';
                        }
                    ?>
                    <div class="newsimg-box">
                        <img src="<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID),  false, '' ); echo $src[0]; ?>" alt="<?php the_title(); ?>">
                    </div>
                    <div class="newtext">
                        <h3><?php the_title(); ?></h3>
                        <p class="time"><?php echo date("M j, Y",$u_time); ?>  - <?php echo get_post_meta($post->ID, "news_setting_via", $single = true) ?></p>
                        <p class="text"><?php the_pure_content(); ?></p>
                    </div>
                </a>
            </div>
            <?php endwhile; ?>
            <?php endif;?>
        </div>
    </div>
</div>
<?php get_footer(); ?>
</body>
</html>